home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / os2tools / bnklysrc / data.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-07-08  |  25.1 KB  |  721 lines

  1. /*--------------------------------------------------------------------------*/
  2. /*                                                                            */
  3. /*                                                                            */
  4. /*        ------------         Bit-Bucket Software <no-Inc>                    */
  5. /*        \ 10001101 /         Writers and Distributors of                    */
  6. /*         \ 011110 /          No-Cost<no-tm> Software.                        */
  7. /*          \ 1011 /                                                            */
  8. /*           ------                                                            */
  9. /*                                                                            */
  10. /*    Copyright (C) 1987, 1988, 1989 by Robert Hartman and Vincent Perriello    */
  11. /*                                                                            */
  12. /*                                                                            */
  13. /*              This module was originally written by Bob Hartman             */
  14. /*                                                                            */
  15. /*                                                                            */
  16. /*                              BinkleyTerm Data                                */
  17. /*                                                                            */
  18. /*                                                                            */
  19. /*      For complete    details  of the licensing restrictions, please refer    */
  20. /*      to the License  agreement,  which  is published in its entirety in    */
  21. /*      the MAKEFILE and BT.C, and also contained in the file LICENSE.210.    */
  22. /*                                                                            */
  23. /*      USE  OF THIS FILE IS SUBJECT TO THE  RESTRICTIONS CONTAINED IN THE    */
  24. /*      BINKLEYTERM  LICENSING  AGREEMENT.  IF YOU DO NOT FIND THE TEXT OF    */
  25. /*      THIS    AGREEMENT IN ANY OF THE  AFOREMENTIONED FILES,    OR IF YOU DO    */
  26. /*      NOT HAVE THESE FILES,  YOU SHOULD  IMMEDIATELY CONTACT THE AUTHORS    */
  27. /*      AT THE  ADDRESSES LISTED BELOW.  IN NO EVENT SHOULD YOU PROCEED TO    */
  28. /*      USE    THIS  FILE    WITHOUT  HAVING   ACCEPTED    THE  TERMS    OF     THE    */
  29. /*      BINKLEYTERM  LICENSING AGREEMENT,  OR SUCH OTHER    AGREEMENT AS YOU    */
  30. /*      ARE ABLE TO REACH WITH THE AUTHORS.                                    */
  31. /*                                                                            */
  32. /*                                                                            */
  33. /*      The Authors can be reached at the following addresses:                */
  34. /*                                                                            */
  35. /*      Robert C. Hartman                      Vincent E. Perriello            */
  36. /*      Spark Software                         VEP Software                    */
  37. /*      427-3 Amherst Street                     111 Carroll Street             */
  38. /*      CS2032, Suite 232                      Naugatuck, CT 06770            */
  39. /*      Nashua, NH 03061                                                        */
  40. /*                                                                            */
  41. /*      FidoNet 1:132/101                      FidoNet 1:141/491                */
  42. /*      Data      (603) 888-8179                 Data     (203) 729-7569         */
  43. /*                                                                            */
  44. /*      Please feel free to contact us at any time to share your comments     */
  45. /*      about our software and/or licensing policies.                         */
  46. /*                                                                            */
  47. /*--------------------------------------------------------------------------*/
  48.  
  49.  
  50. #include <stdio.h>
  51. #include <signal.h>
  52. #include <ctype.h>
  53. #include <conio.h>
  54. #include <string.h>
  55. #include <process.h>
  56.  
  57. #include "com.h"
  58. #include "xfer.h"
  59. #include "zmodem.h"
  60. #include "keybd.h"
  61. #include "sbuf.h"
  62. #include "sched.h"
  63. #include "prototyp.h"
  64.  
  65.  
  66. char *mtext [] = {
  67.                   "Jan", "Feb", "Mar", "Apr", "May", "Jun",
  68.                   "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
  69. };
  70.  
  71. struct baud_str btypes[] = {
  72.                             {"300", BAUD_300},
  73.                             {"1200", BAUD_1200},
  74.                             {"2400", BAUD_2400},
  75.                             {"4800", BAUD_4800},
  76.                             {"9600", BAUD_9600},
  77.                             {"19200", BAUD_19200},
  78. #ifndef OS_2    /*PLF Mon  05-08-1989  04:07:21 ; com02.sys only goes up to 19,200 */
  79.                             {"38400", BAUD_38400},
  80. #endif
  81.                             {NULL, 0}
  82. };
  83.  
  84. struct parse_list DOS_commands[] = {
  85.                                     {7, "noforce"},
  86.                                     {4, "mail"},
  87.                                     {5, "share"},
  88.                                     {5, "dynam"},
  89.                                     {10, "unattended"},
  90.                                     {6, "config"},
  91.                                     {4, "poll"},
  92.                                     {0, NULL}
  93. };
  94.  
  95.  
  96. int locate_x, locate_y, port_ptr;
  97.  
  98. int share = 0;                                     /* if 1, don't uninit FOSSIL  */
  99. int net_params = 0;
  100. int un_attended = 0;
  101. int command_line_un;
  102. int overwrite = 0;
  103. int redo_dynam = 0;
  104. int fullscreen = 1;
  105. int do_screen_blank = 0;
  106. int screen_blank = 0;
  107. int BBStimeout = 2000;
  108. int loglevel = 10;
  109. int gong_allowed = 0;
  110. int MAXport = 2;
  111. int pvtnet = -1;
  112. int poll_tries = 500;                             /* How many tries in a poll? */
  113.  
  114. int com_port = 0;                                 /* Default com port = COM1   */
  115. unsigned int comm_bits = BITS_8;                 /* Default data bits = 8      */
  116. unsigned int parity = NO_PARITY;                 /* Default parity = NONE      */
  117. unsigned int stop_bits = STOP_1;                 /* Default stop bits = 1      */
  118. unsigned int carrier_mask = 0x80;                 /* Default carrier bit = 80H */
  119. unsigned int handshake_mask =  USE_XON | USE_CTS;/* Force CTS/RTS flow control*/
  120.  
  121. int baud;                                         /* Index to baud table       */
  122. int cur_baud;                                     /* Current baud rate          */
  123. int max_baud;                                     /* Maximum baud rate          */
  124.  
  125. char *modem_init = NULL;                         /* Used to init modem          */
  126. char *modem_busy = NULL;                         /* Take modem offhook          */
  127. char *predial = NULL;                             /* Pre-dial setup              */
  128. char *postdial = NULL;                             /* Post-dial cleanup          */
  129.  
  130. unsigned int matrix_mask = TAKE_REQ;             /* Netmail session abilities */
  131. char *system_name = NULL;                         /* Name of system to send      */
  132. char *sysop = NULL;                              /* Name of sysop for yoohoo  */
  133. char *net_info = NULL;                             /* Location of nodelist, etc */
  134. char *hold_area = NULL;                          /* Path to outbound dir      */
  135. ADDR alias[ALIAS_CNT];                             /* List of alias addresses   */
  136. int num_addrs = 0;                                 /* How many we're using      */
  137. int assumed = 0;                                 /* Alias we're now assuming  */
  138. int boss_net = 0;                                 /* Bossnode net address      */
  139. int boss_node = 0;                                 /* Bossnode node address      */
  140.  
  141. char *CurrentNetFiles;                             /* Pointer to netfiles       */
  142. char *CurrentOKFile = NULL;                      /* This session's OKfile     */
  143. char *CurrentFILES = NULL;                         /* File list for FILES       */
  144. char *CurrentAbout = NULL;                         /* Sent if req fails          */
  145. char *CurrentReqTemplate = NULL;                 /* Dynamic req failure file  */
  146. int CurrentReqLim = 0;                             /* Max number of files       */
  147.  
  148. struct secure DEFAULT;                             /* Default paths, etc          */
  149. struct secure KNOWN;                             /* Sec for KNOWN address      */
  150. struct secure PROT;                              /* Sec for PW-PR address      */
  151.  
  152. byte *Txbuf;                                     /* Pointer to xmit buffer      */
  153. byte *Secbuf;                                     /* Pointer to recv buffer      */
  154.  
  155. char *native_protocols = "XYSZT";                /* Protocols we support      */
  156. char *extern_protocols = NULL;                     /* Protocols we can call      */
  157. char *protocols[MAX_EXTERN];                     /* external file protocol      */
  158. int extern_index = 0;                             /* external proto index      */
  159. struct prototable protos[MAX_EXTERN];             /* Table for execution       */
  160.  
  161. char *ext_mail_string[16];                         /* String for UUCP, etc.      */
  162. int lev_ext_mail[16];                             /* Errorlevel for extmail      */
  163. int num_ext_mail;                                 /* Number of ext mails       */
  164.  
  165. char *BBSopt = NULL;                             /* BBS command options       */
  166. char *BBSbanner = NULL;                          /* BBS banner                  */
  167. char *BBSreader = NULL;                          /* Message reader              */
  168. char *BOSSphone = NULL;                          /* Phone number for boss      */
  169. char *BOSSpwd = NULL;                             /* Password for boss          */
  170. char *download_path = "";                        /* Default download path     */
  171. char *BBSnote = NULL;                             /* Tell user BBS loading      */
  172. char *MAILnote = NULL;                             /* Say same for ext mail      */
  173.  
  174. char *BINKpath = "";
  175. char capturename[100];
  176. char *log_name = NULL;
  177. char *config_name = "Binkley.Cfg";
  178. char *swapdir = NULL;
  179.  
  180. char *scan_list[10];
  181. char junk[100];
  182. REGIONP wholewin;
  183. REGIONP settingswin;
  184. REGIONP historywin;
  185. REGIONP holdwin;
  186. REGIONP callwin;
  187. REGIONP filewin;
  188.  
  189. PN_TRNS *pn = NULL;
  190. FILE *status_log = NULL;
  191. int boxtype = 0;
  192. int modemring = 0;                                 /* Modem doesn't differ for
  193.                                                   * RING and RINGING */
  194. int no_collide = 0;                              /* No collision detect */
  195. int cursor_col = 79;
  196. int cursor_row = 22;
  197. char *ans_str = NULL;
  198. char *keys[9];
  199. char *shells[9];
  200.  
  201. struct parse_list rspverbs [] = {
  202.                                  {4, "text"},
  203.                                  {4, "date"},
  204.                                  {4, "time"},
  205.                                  {4, "bink"},
  206.                                  {5, "mynode"},
  207.                                  {6, "system"},
  208.                                  {5, "sysop"},
  209.                                  {6, "yrnode"},
  210.                                  {7, "request"},
  211.                                  {6, "status"},
  212.                                  {5, "abort"},
  213.                                  {4, "exit"},
  214.                                  {4, "line"},
  215.                                  {0, NULL}
  216. };
  217.  
  218. struct parse_list config_lines[] = {
  219.                                     {8,  "SameRing"},
  220.                                     {11, "NewNodeList"},
  221.                                     {13, "QuickNodeList"},
  222.                                     {10, "Answerback"},
  223.                                     {5,  "Macro"},
  224.                                     {5,  "Shell"},
  225.                                     {4,  "Dial"},
  226.                                     {5,  "Event"},
  227.                                     {4,  "Zone"},
  228.                                     {6,  "MaxReq"},
  229.                                     {8,  "LogLevel"},
  230.                                     {4,  "Baud"},
  231.                                     {7,  "MaxPort"},
  232.                                     {4,  "Port"},
  233.                                     {7,  "Carrier"},
  234.                                     {9,  "StatusLog"},
  235.                                     {6,  "Reader"},
  236.                                     {9,  "BossPhone"},
  237.                                     {7,  "BossPwd"},
  238.                                     {8,  "Protocol"},
  239.                                     {6,  "System"},
  240.                                     {5,  "Sysop"},
  241.                                     {4,  "Boss"},
  242.                                     {5,  "Point"},
  243.                                     {3,  "Aka"},
  244.                                     {4,  "Hold"},
  245.                                     {9,  "DownLoads"},
  246.                                     {7,  "NetFile"},
  247.                                     {4,  "Init"},
  248.                                     {4,  "Busy"},
  249.                                     {6,  "Prefix"},
  250.                                     {8,  "NodeList"},
  251.                                     {5,  "Avail"},
  252.                                     {6,  "OKFile"},
  253.                                     {5,  "About"},
  254.                                     {8,  "MailNote"},
  255.                                     {6,  "Banner"},
  256.                                     {10, "UnAttended"},
  257.                                     {9,  "OverWrite"},
  258.                                     {4,  "Rev3"},
  259.                                     {7,  "ReqOnUs"},
  260.                                     {8,  "LockBaud"},
  261.                                     {7,  "TimeOut"},
  262.                                     {5,  "NoSLO"},
  263.                                     {9,  "SlowModem"},
  264.                                     {11, "SmallWindow"},
  265.                                     {8,  "NoPickup"},
  266.                                     {10, "NoRequests"},
  267.                                     {7,  "NetMail"},
  268.                                     {6,  "Suffix"},
  269.                                     {12, "NoFullScreen"},
  270.                                     {8,  "AutoBaud"},
  271.                                     {4,  "Gong"},
  272.                                     {9,  "NoCollide"},
  273.                                     {8,  "TBBSList"},
  274.                                     {8,  "TaskView"},
  275.                                     {7,  "TopView"},
  276.                                     {9,  "ExtrnMail"},
  277.                                     {7,  "BBSNote"},
  278.                                     {3,  "BBS"},
  279.                                     {10, "ScriptPath"},
  280.                                     {7,  "BoxType"},
  281.                                     {9,  "MultiLink"},
  282.                                     {7,  "Include"},
  283.                                     {11, "CaptureFile"},
  284.                                     {9,  "CursorCol"},
  285.                                     {9,  "CursorRow"},
  286.                                     {9,  "DoingMail"},
  287.                                     {8,  "EnterBBS"},
  288.                                     {10, "PrivateNet"},
  289.                                     {6,  "Packer"},
  290.                                     {7,  "Cleanup"},
  291.                                     {9,  "AfterMail"},
  292.                                     {6,  "Colors"},
  293.                                     {9,  "JanusBaud"},
  294.                                     {11, "ReqTemplate"},
  295.                                     {10, "KnownAvail"},
  296.                                     {12, "KnownReqList"},
  297.                                     {10, "KnownAbout"},
  298.                                     {12, "KnownInbound"},
  299.                                     {11, "KnownReqLim"},
  300.                                     {11, "KnownReqTpl"},
  301.                                     {9,  "ProtAvail"},
  302.                                     {11, "ProtReqList"},
  303.                                     {9,  "ProtAbout"},
  304.                                     {11, "ProtInbound"},
  305.                                     {10, "ProtReqLim"},
  306.                                     {10, "ProtReqTpl"},
  307.                                     {11, "Application"},
  308.                                     {7,  "NoZones" },
  309.                                     {6,  "Answer"},
  310.                                     {9,  "PollTries"},
  311.                                     {7,  "SwapDir"},
  312.                                     {7,  "Address"},
  313.                                     {10, "CurMudgeon"},
  314.                                     {7,  "NoWaZOO"},
  315.                                     {11, "ScreenBlank"},
  316.                                     {10, "Mark_Kromm"},
  317.                                     {6,  "Server"},
  318.                                     {0, NULL}
  319. };
  320.  
  321. int Netmail_Session;
  322. int isOriginator = 0;                             /* Global logical "I'm the
  323.                                                   * caller"  */
  324. int got_arcmail;
  325. int got_packet;
  326. int got_mail;
  327. int mail_finished;
  328. int sent_mail;
  329. int made_request;                                 /* WaZOO file request flag */
  330. int net_problems;                                 /* This should be external */
  331.  
  332. int remote_zone;
  333. int remote_net;
  334. int remote_node;
  335. int remote_point;
  336. int remote_capabilities;
  337.  
  338. char *remote_password;
  339. char *BBSesc = "\rPress <Escape> to enter BBS.\r";
  340. char *noBBS = "\r\rProcessing Mail. Please hang up.\r\r";
  341. int no_pickup = 0;
  342. int no_WaZOO = 0;
  343. int no_WaZOO_Session = 0;
  344.  
  345. long total_bytes = 0L;                             /* Total bytes transferred          */
  346.  
  347. char *NothingToSend_msg = "+Nothing to send from %d:%d/%d to %d:%d/%d";
  348.  
  349. char *request_template = "%s%04x%04x.REQ";
  350.  
  351. char *ext_flags = "ODCH";                        /* Change to whatever, and */
  352.  
  353. char *prodcode[] = {
  354.                     "Fido",
  355.                     "Rover",
  356.                     "SEAdog",
  357.                     "Dropped-3",
  358.                     "Slick/150",
  359.                     "Opus",
  360.                     "Dutchie",
  361.                     "Dropped-7",
  362.                     "Tabby",
  363.                     "Hoster",
  364.                     "Wolf/68k",
  365.                     "QMM",
  366.                     "FrontDoor",
  367.                     "Dropped-13",
  368.                     "Dropped-14",
  369.                     "Dropped-15",
  370.                     "Dropped-16",
  371.                     "Mailman",
  372.                     "OOPS",
  373.                     "GS-Point",
  374.                     "BGMail",
  375.                     "CrossBow",
  376.                     "Dropped-22",
  377.                     "Dropped-23",
  378.                     "Dropped-24",
  379.                     "Warlock",
  380.                     "D'Bridge",
  381.                     "BinkleyTerm",
  382.                     "Yankee",
  383.                     "FGet/Send",
  384.                     "Daisy",
  385.                     "Polar Bear",
  386.                     "The-Box"
  387. };
  388.  
  389. char no_zapzed = 0;
  390. int hup = 0;
  391. int on_our_nickel = 0;
  392.  
  393. char fossil_buffer[128];
  394. char out_buffer[128];
  395. char *fossil_fetch_pointer = fossil_buffer;
  396. char *out_send_pointer = out_buffer;
  397. int fossil_count = 0;
  398. int out_count = 0;
  399. int old_fossil = 1;
  400. int rev3 = 0;
  401. char ctrlc_ctr;
  402. FOSINFO fossil_info =
  403.  
  404. {
  405.  0, 0, 0, 0L, 0, 0, 0, 0, 0, 0, 0
  406. };
  407.  
  408. char no_requests = 0;
  409. int who_is_he = 0;
  410.  
  411. int curmudgeon = 0;                              /* 1 = Randy Bush             */
  412. int small_window = 0;
  413. int no_overdrive = 0;
  414.  
  415. #ifdef JANUS
  416. int janus_baud = 0;
  417. byte JANUS_WaitFlag;                             /* Tells JANUS_RawByte()
  418.                                                   * whether or not to wait     */
  419. word JANUS_TimeoutSecs;                          /* How long to wait for
  420.                                                   * various things             */
  421. #endif
  422.  
  423. int called_zone, called_net, called_node, mail_only;
  424. int caller;
  425. int more_mail;
  426. int doing_poll;
  427.  
  428. char BBSwelcome[1024];
  429. char *aftermail;
  430.  
  431. char *outb[] = {
  432.                 "*.?UT", "*.?LO", "*.REQ", NULL, (char *) (-1)
  433. };
  434.  
  435. /*PLF Sat  05-06-1989  00:01:45
  436.  *
  437.  *    struct FILEINFO dta_str;
  438.  *
  439.  *     - This global was only used in mailsubs.c.
  440.  *
  441.  */
  442. char next_one[64];
  443.  
  444. int slowmodem = 0;
  445.  
  446. PN_TRNS *pn_head = NULL;
  447.  
  448. int have_dv = 0;
  449. int have_ddos = 0;
  450. int have_tv = 0;
  451. int have_ml = 0;
  452. int lock_baud = 0;
  453.  
  454. char e_input[255];
  455.  
  456. char stat_line[256];
  457. char *Loc_msg = e_input;
  458.  
  459. char *_s_mdm7idunno = "I dunno";
  460. char *_s_mdm7giveup = "Give up";
  461. char *_s_mdm7toolong = "File name too long";
  462. char *_s_mdm7chksum = "Checksum";
  463.  
  464. char *PACKET_msg = " Sending MailPkt";
  465. char *FIND_msg = "find";
  466. char *IDUNNO_msg = "???";
  467. char *FLAGGING_msg = " Flagging %s as sent";
  468. char *NOTSENT_msg = " File %s not sent";
  469. char *TRUNC_msg = " File %s truncated";
  470. char *RENAME_msg = "+Dupe renamed: %s";
  471. char *MEMOVFL_msg = " Memory Overflow";
  472. char *CAN_msg = " Transfer cancelled";
  473. char *DEVICE_msg = " Open Character Device";
  474. char *KBD_msg = " Keyboard Escape";
  475. char *TIME_msg = " Timeout";
  476. char *CARRIER_msg = " Lost Carrier";
  477. char *READ_msg = " File Read";
  478. char *SEEK_msg = " File Seek";
  479. char *NAK_msg = "NAK";
  480. char *FUBAR_msg = " Too many errors";
  481. char *CMPL_msg = "Bad block complement";
  482. char *CRC_msg = "CRC";
  483. char *EOT_msg = "EOT";
  484. char *SYNC_msg = "Out of Sync";
  485. char *CHK_msg = "Checksum";
  486. char *SHRT_msg = "Short block";
  487. char *IO_msg = "I/O Error";
  488. char *CREATE_msg = "Create";
  489. char *CLOSE_msg = "Close";
  490. char *UNLINK_msg = "Unlink";
  491. char *UNLINKING_msg = " Unlinking %s after sending";
  492. char *OPEN_msg = "Open";
  493. char *WRITE_msg = "Write";
  494. char *NOTHING_msg = " Nothing transferred";
  495. char *local_CEOL = "\033[K";
  496.  
  497. char *wkday[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
  498.  
  499. int newnodelist = 0;                             /* if 1, use new nodelist.   */
  500. int autobaud = 0;                                 /* Use highest baudrate when
  501.                                                   * calling out */
  502.  
  503. int found_zone = 0;                              /* What zone found node is in*/
  504. struct _newnode newnodedes;                      /* structure in new list      */
  505. char far *node_index = NULL;                     /* pointer to node array      */
  506.  
  507. HISTORY hist;
  508. EVENT *e_ptrs[256];
  509. int requests_ok = 1;
  510. int num_events = 0;
  511. int cur_event = -1;
  512. int got_sched = 0;
  513. int noforce = 0;
  514. int no_zones = 0;
  515. int max_connects = 3;
  516. int max_noconnects = 10000;
  517. int server_mode = 0;
  518. char *packer;
  519. char *cleanup;
  520. char *answerback;
  521.  
  522. long TX_FileSize;
  523. long TX_StTime;
  524. int TX_OldETA;
  525.  
  526. long RX_FileSize;
  527. long RX_StTime;
  528. int RX_OldETA;
  529.  
  530. byte *ResendingFrom = "Resending from %ld";
  531. byte *XFER_str = " pos=        , len=    , ETA=     min.";
  532. long total_bytes;
  533.  
  534. char *script_path;                                 /* Where the script files
  535.                                                   * live */
  536.  
  537. char Rxhdr[4];                                     /* Received header           */
  538. char Txhdr[4];                                     /* Transmitted header          */
  539.  
  540. /*PLF Fri  05-05-1989  06:45:48 ; There was no need for these...so many globals
  541.  * already!! Some day i might attack all of them...then the goto's. My god,
  542.  * the zmodem routines alone have 69 goto's!.
  543.  *
  544.  *     #ifndef GENERIC
  545.  *     long *RXlong = (long *) &Rxhdr[0];
  546.  *     long *TXlong = (long *) &Txhdr[0];
  547.  *
  548.  *     #endif
  549.  */
  550. long Rxpos;                                      /* Received file position      */
  551. int Txfcs32;                                     /* TURE means send binary
  552.                                                   * frames with 32 bit FCS      */
  553. int Crc32t;                                      /* Display flag indicating
  554.                                                   * 32 bit CRC being sent */
  555. int Crc32;                                         /* Display flag indicating
  556.                                                   * 32 bit CRC being received */
  557. int Znulls;                                      /* # of nulls to send at
  558.                                                   * beginning of ZDATA hdr       */
  559.  
  560. int Rxtimeout;                                     /* Tenths of seconds to wait
  561.                                                   * for something           */
  562. int Rxframeind;                                  /* ZBIN ZBIN32,ZHEX type of
  563.                                                   * frame received */
  564.  
  565. byte *Filename;                                  /* Name of the file being
  566.                                                   * up/downloaded              */
  567.  
  568.  
  569.  
  570. byte *Skip_msg = " SKIP command received";
  571. byte *Cancelled_msg = " Transfer cancelled";
  572. word z_size = 0;
  573.  
  574. byte Resume_WaZOO;                                 /* Flags resumption of
  575.                                                   * aborted WaZOO xfer    */
  576. byte Resume_name[13];                             /* "Real" name of file being
  577.                                                   * received      */
  578. byte Resume_info[48];                             /* File size&time info for
  579.                                                   * rx file         */
  580. byte Abortlog_name[PATHLEN];                     /* Path of WaZOO aborted
  581.                                                   * xfer log      */
  582.  
  583. PFI3 nodefunc = opusfind;                         /* Nodelist function to use */
  584.  
  585. COLORS colors = { 7, 7, 7, 7, 7, 7 };
  586.  
  587. #ifndef OS_2 /*PLF Fri    05-05-1989    07:53:53 */
  588. int (far pascal *vfossil_funcs[20]) () = {
  589.    (int far *) 0L, (int far *) 0L, (int far *) 0L,
  590.    (int far *) 0L, (int far *) 0L, (int far *) 0L,
  591.    (int far *) 0L, (int far *) 0L, (int far *) 0L,
  592.    (int far *) 0L, (int far *) 0L, (int far *) 0L,
  593.    (int far *) 0L, (int far *) 0L, write_screen,
  594.    write_chars,    (int far *) 0L, (int far *) 0L,
  595.    (int far *) 0L, (int far *) 0L
  596. };
  597. #endif
  598.  
  599. int vfossil_installed = 0;
  600.  
  601. char *logptr;
  602.  
  603. MAILP mail_top;
  604. MAILP next_mail;
  605.  
  606. char  mdm_reliable[80];
  607.  
  608.  
  609. /* First, the polynomial itself and its table of feedback terms.  The  */
  610. /* polynomial is                                                       */
  611. /* X^32+X^26+X^23+X^22+X^16+X^12+X^11+X^10+X^8+X^7+X^5+X^4+X^2+X^1+X^0 */
  612. /* Note that we take it "backwards" and put the highest-order term in  */
  613. /* the lowest-order bit.  The X^32 term is "implied"; the LSB is the   */
  614. /* X^31 term, etc.    The X^0 term (usually shown as "+1") results in    */
  615. /* the MSB being 1.                                                    */
  616.  
  617. /* Note that the usual hardware shift register implementation, which   */
  618. /* is what we're using (we're merely optimizing it by doing eight-bit  */
  619. /* chunks at a time) shifts bits into the lowest-order term.  In our   */
  620. /* implementation, that means shifting towards the right.  Why do we   */
  621. /* do it this way?    Because the calculated CRC must be transmitted in  */
  622. /* order from highest-order term to lowest-order term.    UARTs transmit */
  623. /* characters in order from LSB to MSB.  By storing the CRC this way,  */
  624. /* we hand it to the UART in the order low-byte to high-byte; the UART */
  625. /* sends each low-bit to hight-bit; and the result is transmission bit */
  626. /* by bit from highest- to lowest-order term without requiring any bit */
  627. /* shuffling on our part.  Reception works similarly.                   */
  628.  
  629. /* The feedback terms table consists of 256, 32-bit entries.  Notes:   */
  630. /*                                                                       */
  631. /*       The table can be generated at runtime if desired; code to do so */
  632. /*       is shown later.    It might not be obvious, but the feedback       */
  633. /*       terms simply represent the results of eight shift/xor opera-    */
  634. /*       tions for all combinations of data and CRC register values.       */
  635. /*                                                                       */
  636. /*       The values must be right-shifted by eight bits by the "updcrc"  */
  637. /*       logic; the shift must be unsigned (bring in zeroes).  On some   */
  638. /*       hardware you could probably optimize the shift in assembler by  */
  639. /*       using byte-swap instructions.                                   */
  640.  
  641. long cr3tab[] = {                          /* CRC polynomial 0xedb88320 */
  642. 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
  643. 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,
  644. 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
  645. 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5,
  646. 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
  647. 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
  648. 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f,
  649. 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d,
  650. 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
  651. 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
  652. 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457,
  653. 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
  654. 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb,
  655. 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9,
  656. 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
  657. 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad,
  658. 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683,
  659. 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
  660. 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7,
  661. 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
  662. 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
  663. 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79,
  664. 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f,
  665. 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
  666. 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
  667. 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21,
  668. 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
  669. 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45,
  670. 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db,
  671. 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
  672. 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf,
  673. 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
  674. };
  675.  
  676. /*
  677.  *
  678.  * -rev 04-16-87  (abbreviated)
  679.  *    The CRC-16 routines used by XMODEM, YMODEM, and ZMODEM
  680.  *    are also in this file, a fast table driven macro version
  681.  */
  682.  
  683.  
  684. /* crctab calculated by Mark G. Mendel, Network Systems Corporation */
  685. unsigned short crctab[256] = {
  686.              0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7,
  687.              0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef,
  688.              0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6,
  689.              0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de,
  690.              0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485,
  691.              0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d,
  692.              0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4,
  693.              0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc,
  694.              0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823,
  695.              0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b,
  696.              0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12,
  697.              0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a,
  698.              0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41,
  699.              0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49,
  700.              0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70,
  701.              0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78,
  702.              0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f,
  703.              0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067,
  704.              0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e,
  705.              0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256,
  706.              0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d,
  707.              0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405,
  708.              0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c,
  709.              0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634,
  710.              0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab,
  711.              0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3,
  712.              0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a,
  713.              0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92,
  714.              0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9,
  715.              0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1,
  716.              0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8,
  717.              0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0
  718. };
  719.  
  720.  
  721.